<?
require("page.inc");
require("database.inc");
$managebook=new page2();
$content="";
$serchsrt="select isbn,title,author,price from books";
@$con=new mysqli($lu_host,$lu_user,$lu_psw,$lu_db);
if(mysqli_connect_error()){
	$managebook->display();
	echo "Database Connet Error.";
	$managebook->displayfooter();
	exit;
	}
$result=$con->query($serchsrt);
$numrow=$result->num_rows;//注意这个地方不带括号
//echo $numrow;
$managebook->display();
?>
<style type="text/css">
.bookall td{
	background-color:#000000;
	color:#FFFFFF;
}
</style>
<h1><center><font color="#000000">All Books Here</font></center></h1><br />
<table  class="bookall" width="80%" align="center">
    <tr>
        <td>ID</td>
        <td>Title</td>
        <td>ISBN</td>
        <td>Author</td>
        <td>Price($)</td>
        <td>Edit</td>
        <td>Delete</td>
    </tr>

<?
for($i=0;$i<$numrow;$i++){
	$row=$result->fetch_assoc();
	echo "<tr><td>".($i+1)."</td><td>".$row['title']."</td><td>".$row['isbn']."</td><td>".$row['author']."</td><td>".$row['price']."</td><td><a href=\"editbook.php?isbn=".$row['isbn']."\">Edit</a></td><td><a href=\"deletebook.php?isbn=".$row['isbn']."\">Delete</a></td>";
	}
echo "</table>";	
$result->free();
$con->close();
$managebook->displayfooter();





















?>